CC = gcc
BUILD_PATH=build 
#vpath %.h include   
#INCLUDE = -I/usr/include -Iinclude
CFLAGS = -Wall -O0 -g -std=c99 $(INCLUDE)
SOURCES = $(wildcard *.c)
OBJS = $(patsubst %.c,%.o,$(SOURCES))
EXES = test
$(EXES):$(OBJS)
	$(CC) -o test test.o sort.o heap.o

#include $(subst .c,.d,$(SOURCES))
	
#%.d:%.c
#	$(CC) -M  $(INCLUDE) $<  > $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$
	 
	


all: $(EXES)
%.o:%.c
	@echo Compiling $< to $@ ......
	$(CC) -c $(CFLAGS) $< -o $@

clean:
	rm -f  $(EXES)
	find . -name '*.[od]' | xargs rm -f
.PHONY: clean
